package com.cy.personer.biz.impl;

import com.cy.personer.bean.Work;
import com.cy.personer.biz.WorkBiz;
import com.cy.personer.ceptor.OperationLog;
import com.cy.personer.mapper.ManageWorkMapper;
import com.cy.personer.mapper.WorkLoginMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class WorkBizImpl implements WorkBiz {
    @Resource
    private WorkLoginMapper workLoginMapper;
    @Resource
    private ManageWorkMapper manageWorkMapper;

    //工作人员登录
    @Override
    public Work login(Work work) {
        return workLoginMapper.login(work);
    }

    //条件分页查询
    @Override
    public List<Work> getWork(Work work) {
        return manageWorkMapper.getWork(work);
    }

    //修改工作人员的状态id
    @OperationLog(operType="修改",methods = "修改工作人员状态" )
    @Override
    public boolean updataState(int workId,int stateId) {
        return manageWorkMapper.updataState(workId,stateId);
    }

    //检验用户名是否可用
    @Override
    public Work accountCheck(String account) {
        return manageWorkMapper.accountCheck(account);
    }

    //增加内部工作人员
    @OperationLog(operType="添加",methods = "添加员工账号" )
    @Override
    public boolean addWork(Work work) {
        return manageWorkMapper.addWork(work);
    }

    //通过工作编号查找工作人员
    @Override
    public Work findWork(int workId) {
        return manageWorkMapper.findWork(workId);
    }

    //修改工作人员信息
    @OperationLog(operType="修改",methods = "修改工作人员信息" )
    @Override
    public boolean eitWork(Work work) {
        return manageWorkMapper.eitWork(work);
    }

    //修改工作人员密码
    @OperationLog(operType="修改",methods = "修改登录密码" )
    @Override
    public boolean changeWorkPwd(Work work) {
        return manageWorkMapper.changeWorkPwd(work);
    }

    public WorkLoginMapper getWorkLoginMapper() {
        return workLoginMapper;
    }

    public void setWorkLoginMapper(WorkLoginMapper workLoginMapper) {
        this.workLoginMapper = workLoginMapper;
    }

    public ManageWorkMapper getManageWorkMapper() {
        return manageWorkMapper;
    }

    public void setManageWorkMapper(ManageWorkMapper manageWorkMapper) {
        this.manageWorkMapper = manageWorkMapper;
    }
}
